package com.xbongbong.saas.model.impl;

import com.xbongbong.saas.domain.dao.OpportunityWorkLogDao;
import com.xbongbong.saas.domain.entity.OpportunityWorkLogEntity;
import com.xbongbong.saas.model.OpportunityWorkLogModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/3/10 16:49
 * @since v1.0
 */
@Service("opportunityWorkLog")
public class OpportunityWorkLogModelImpl implements OpportunityWorkLogModel {

    @Resource
    private OpportunityWorkLogDao opportunityWorkLogDao;

    @Override
    public List<OpportunityWorkLogEntity> findEntitys(Map<String, Object> modelMap) {
        return opportunityWorkLogDao.findEntitys(modelMap);
    }

    @Override
    public void save(OpportunityWorkLogEntity opportunityWorkLogEntity) {
        if (opportunityWorkLogEntity.getId() == null){
            opportunityWorkLogDao.insert(opportunityWorkLogEntity);
        }else {
            opportunityWorkLogDao.update(opportunityWorkLogEntity);
        }
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return opportunityWorkLogDao.getEntitysCount(param);
    }

}
